<script>
import {data} from "autoprefixer";

export default {
  data() {
    return {
      bed:{
      },
      pageable:{
        currentpage:1,
        pagesizes:[5,10,20,30],
        pagesize:5,
        total:''
      },
    }
  },
  methods:{
      handleSizeChange(val) {
          this.pageable.pagesize=val
          this.findBed()
      },
      handleCurrentChange(val) {
          // console.log(`当前页: ${val}`);
          this.pageable.currentpage=val
          this.findBed()
      },
    findBed(){
      this.$axios.get('AdminBed/findBed',{
          params:{
              page:this.pageable.currentpage,
              limit:this.pageable.pagesize
          }

      }).then(data=>{
        this.bed=data.data.data.records
        this.pageable.total=data.data.data.total
      })
    },
  },
  mounted() {
    this.findBed()
  }
}


</script>

<template>
  <div>
    <template>
      <el-table
        :data="bed"
        stripe
        style="width: 100%">
        <el-table-column
          prop="bedId"
          label="序号"
          width="180">
        </el-table-column>
        <el-table-column
          prop="hotelName"
          label="所属酒店"
          width="180">
        </el-table-column>
        <el-table-column
          prop="bedName"
          label="床型名称">
        </el-table-column>
        <el-table-column
          prop="bedPrice"
          label="床型价钱">
        </el-table-column>
        <el-table-column
          prop="bedInfo"
          label="详细信息">
        </el-table-column>
        <el-table-column
          prop="bedNum"
          label="房型数量">
        </el-table-column>
        <el-table-column
          label="房型图片">
          <template slot-scope="scope">
            <el-image
              style="width: 100px; height: 100px"
              :src="scope.row.bedPic"
              fit="fill"></el-image>
          </template>
        </el-table-column>
      </el-table>
        <el-pagination
                @size-change="handleSizeChange"
                @current-change="handleCurrentChange"
                :current-page=pageable.currentpage
                :page-sizes=pageable.pagesizes
                :page-size=pageable.pagesize
                layout="total, sizes, prev, pager, next, jumper"
                :total=pageable.total
        >
        </el-pagination>
    </template>
  </div>
</template>

<style>

</style>
